package com.choichumgming.rentcat.web.controller;

import com.choichumgming.rentcat.common.api.CommonResult;
import com.choichumgming.rentcat.dto.OrderProcessParam;
import com.choichumgming.rentcat.dto.OrderReturnParam;
import com.choichumgming.rentcat.service.OmsBuyerOrderService;
import com.choichumgming.rentcat.service.OmsOrderService;
import com.choichumgming.rentcat.service.OmsSellerOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@Api(tags = "OmsBuyerOrderController",description = "订单管理")
@RequestMapping("/seller")
public class OmsSellerOrderController {
    @Autowired
    private OmsSellerOrderService omsSellerOrderService;

    @ApiOperation("根据状态查看所有卖家订单")
    @RequestMapping(value = "/list/{userId}",method = RequestMethod.GET)
    @ResponseBody
    public CommonResult list(@PathVariable("userId") Long userId){

        return  omsSellerOrderService.getSellerList(userId);
    }

    @ApiOperation("完善订单发货地址")
    @RequestMapping(value = "update/item",method = RequestMethod.POST)
    @ResponseBody
    public CommonResult processOrder(@RequestBody OrderProcessParam orderProcessParam){
       int result =  omsSellerOrderService.processOrder(orderProcessParam);
       if (result > 0 ){
           return  CommonResult.success(result);
       }else {
           return CommonResult.failed();
       }
    }



}
